package com.zp.domain;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

/**
 * create user_role entity with properties
 * 
 * @version 1.0
 * 
 * @since 1.0
 * 
 * @author chenlijun08@gmail.com
 * 
 * @date 2014/1/13
 * 
 */
@XmlRootElement
@Entity
@Table(catalog = "zzyyp", name = "tb_user_role")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class UserRole implements Serializable {
	private static final long serialVersionUID = 1L;
	private String id;
	// primary key of user
	private String userId;
	// primary key of role
	private String roleId;
	// code of role
	private String code;

	@Id
	@GenericGenerator(name = "generator", strategy = "uuid")
	@GeneratedValue(generator = "generator")
	@Column(length = 32, nullable = false, name = "user_role_id", unique = true)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(length = 32, nullable = false, name = "user_id")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Column(length = 32, nullable = false, name = "role_id")
	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	@Column(length = 20, nullable = false, name = "role_code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

}
